package za.um.td.state.client;

import za.um.td.entity.manager.LevelEntityManager;
import za.um.td.entity.mouse.MouseEntity;

import com.jmex.game.state.BasicGameStateNode;
import com.jmex.game.state.GameState;

public class ClientStateNode extends BasicGameStateNode<GameState> {

	public enum ClientState {
		LEVEL
	}
	
	private static final String NAME = "ClientStateNode";
	private static ClientStateNode instance = null;
	
	private ClientState clientState;
	
	private MouseEntity mouse;

	private ClientStateNode() {
		
		super(NAME);
		initMouse();
		
		// TODO: change this state
		clientState = ClientState.LEVEL;
	}

	private void attachChildren() {
		attachChild(InputStateNode.getInstance());
		attachChild(RenderStateNode.getInstance());
	}

	private void initMouse() {
		mouse = new MouseEntity("Mouse Input");
	}
	
	public static ClientStateNode createInstance() {
		if (instance == null) {
			instance = new ClientStateNode();
			
			LevelEntityManager.createInstance();
			
			instance.attachChildren();
			instance.activateAllChildren();
		}
		return instance;
	}
	
	public ClientState getClientState() {
		return clientState;
	}

	public static ClientStateNode getInstance() {
		return instance;
	}

	public MouseEntity getMouse() {
		return mouse;
	}
}
